package com.lz.handler;

import com.lz.exception.SellException;
import com.lz.exception.SellerAuthorizeException;
import com.lz.utils.ResultVOUtil;
import com.lz.vo.ResultVO;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 异常处理handler
 * Created by Administrator on 2018/9/6 0006.
 */
@ControllerAdvice
public class SellerExceptionlHandler {

    //拦截登陆异常
    @ExceptionHandler(value = SellerAuthorizeException.class)
    public String handlerAuthorizeException(){

        return "websocket/websocket";
    }

    @ExceptionHandler(value = SellException.class)
    @ResponseBody
    public ResultVO handlerSellException(SellException e){
        return ResultVOUtil.error(e.getCode(),e.getMessage());
    }
}
